﻿using System;

class Pillar
{
    static byte[] bitsCount = new byte[8];

    static byte CalcSum(int start, int end)
    {
        if(start>end)
        {
            return (0);
        }
        byte result = 0;
        for (int i = start; i <= end; i++)
        {
            result += bitsCount[i];
        }
        return(result);
    }

    static void Main()
    {
        bitsCount = new byte[8];
        string input;
        byte currentNumber;
        for (byte i = 0; i < 8; i++)
        {
            input = Console.ReadLine();
            currentNumber = byte.Parse(input);
            for (byte j = 0; j < 8; j++)
            {
                if( ((currentNumber>>j)&1) == 1)
                {
                    bitsCount[j]++;
                }
            }
        }
        int result = -1;
        byte pillarPos = 0;

        for (byte i = 0; i < 8; i++)
        {
            if (CalcSum(0, i - 1) == CalcSum(i + 1, 7))
            {
                result = CalcSum(0, i - 1);
                pillarPos = i;
            }
        }
        if (result == -1)
        {
            Console.WriteLine("No");
        }
        else
        {
            Console.WriteLine(pillarPos);
            Console.WriteLine(result);
        }
    }
}